﻿package mortal.game.resource.tableConfig
{
    import Message.DB.Tables.*;
    import com.gengine.resource.*;
    import flash.utils.*;
    import mortal.game.view.common.*;

    public class GuildBossCopyConfig extends Object
    {
        private var _dic:Dictionary;
        private static var _instance:GuildBossCopyConfig;

        public function GuildBossCopyConfig()
        {
            if (_instance != null)
            {
                throw new Error(" GuildBossCopyConfig 单例 ");
            }
            this.init();
            return;
        }// end function

        public function init() : void
        {
            var _loc_1:* = ConfigManager.instance.getJSONByFileName("t_guild_boss_copy.json");
            this.write(_loc_1);
            return;
        }// end function

        private function write(param1:Object) : void
        {
            var _loc_2:TGuildBossCopy = null;
            var _loc_3:Object = null;
            for each (_loc_3 in param1)
            {
                
                _loc_2 = new TGuildBossCopy();
                ClassTypesUtil.copyValue(_loc_2, _loc_3);
                if (!this._dic)
                {
                    this._dic = new Dictionary();
                }
                this._dic[_loc_2.color] = _loc_2;
            }
            return;
        }// end function

        public function getConfigByColor(param1:int) : TGuildBossCopy
        {
            return this._dic[param1];
        }// end function

        public function getConfigArr() : Array
        {
            var _loc_2:TGuildBossCopy = null;
            var _loc_1:Array = [];
            for each (_loc_2 in this._dic)
            {
                
                _loc_1.push(_loc_2);
            }
            _loc_1.sortOn("color", Array.NUMERIC);
            return _loc_1;
        }// end function

        public static function get instance() : GuildBossCopyConfig
        {
            if (_instance == null)
            {
                _instance = new GuildBossCopyConfig;
            }
            return _instance;
        }// end function

    }
}
